#include <stdio.h>  
#include <sys/ipc.h>  
#include <map>
#include <iostream>
#include <list>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <vector>
#include <iterator>
#include <algorithm>
#include <sys/time.h>
#include <cstring>
#include <set>
#include <hash_set>
#include <ctime>
#include <vector>
using namespace std;

void testset()
{
    set<int> myset;   
    for (int i=1; i<=10; i++) 
    {
         myset.insert(i*10);  
    } 
  
    pair<set<int>::const_iterator,set<int>::const_iterator> ret;  
    ret = myset.equal_range(30);  
  
    cout << "the lower bound points to: " << *ret.first << '\n';  
    cout << "the upper bound points to: " << *ret.second << '\n';    
}

void testvector()
{
    std::vector<int> myvector;
    for(int i=0;i<10;i++)
    {
       myvector.push_back(i);
    }
 
   for(vector<int>::iterator iter=myvector.begin(); iter!=myvector.end(); iter++)
   {
        myvector.erase(iter);
        //iter = veci.erase(iter);
   }
   
   for(vector<int>::iterator iter=myvector.begin(); iter!=myvector.end(); iter++)
   {
     cout<<*iter<<endl;
   }
 
}

// test if iter++ is probilem
void testmap()
{
    std::map<int,int> mymap ; 
     for(int i=10;i<50;i++)
    {
       mymap.insert(std::pair<int,int>(i,i));
    }
    
    // erase all odd numbers from c
    for(map<int, int>::iterator it = mymap.begin(); it != mymap.end();++it)
    {
            mymap.erase(it);
           //it = mymap.erase(it);
      
    }
    for (map<int,int>::iterator it=mymap.begin(); it!=mymap.end(); ++it)
    { 
        cout << it->first << " => " << it->second << '\n';
    }
}
int main(int argc, char* argv[]) 
{    
    testmap();
    return 0;
}



